package com.example.widget;

import android.app.Activity;
import android.os.Bundle;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.view.Menu;
import android.widget.TextView;

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		// TextView 에 HTML 표현 하기
		String source = "<b><font color=#ff0000> Html View using TextView" +
				 "</font></b><br><br><a href='http://m.naver.com'>naver.com</a>" +
				 "<br><br><a href='http://mainia.tistory.com'>mainia.tistory.com</a>";
		 
		TextView textView = (TextView) findViewById(R.id.message_window);
		textView.setText(Html.fromHtml(source)); // URL 링크를 사용할수 있도록 변경, 링크가 적용될려면 http:// 로 시작해야한다.
		textView.setMovementMethod(LinkMovementMethod.getInstance());


		/*
		 * Button btnTest = (Button)findViewById(R.id.button);
		 * btnTest.setOnClickListener(new View.OnClickListener() {
		 * 
		 * @Override public void onClick(View v) {
		 * 
		 * } });
		 */

		/** capture 기능 */
		/*Button myBtn = (Button) findViewById(R.id.button);
		myBtn.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				View v1 = v.getRootView();
				v1.setDrawingCacheEnabled(true);

				Bitmap bm = v1.getDrawingCache();// 화면을 찍어서 Bitmap 파일로 전달한다.
				BitmapDrawable bitmapDrawable = new BitmapDrawable(bm);
				// <a
				// href="http://www.androidpeople.com/wp-content/uploads/2010/10/home-screen.png"><img
				// src="http://www.androidpeople.com/wp-content/uploads/2010/10/home-screen.png"
				// alt="Android Take screen shot from code" title="home screen"
				// width="320" height="480"
				// class="aligncenter size-full wp-image-1836" /></a>
				ImageView view2 = (ImageView) findViewById(R.id.ImageView01);
				view2.setBackgroundDrawable(bitmapDrawable);

			}
		});*/
	}
	
	/** 화면에 찍은 데이타를 표현한다 */
	private void screenShotPreview(){
		
	}
	
	/** 화면을 찍은 스크린샷 저장 한다 */
	private void screenShotSave(){
		
	}
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_main, menu);
		return true;
	}

}
